import request from '@/utils/request'

export function fetchMenuList(query) {
    return request({
        url: '/user/api/menuResource/query/list',
        method: 'get',
        params: query
    })
}
// 用户数据分页

export function fetchRolePage(query) {
    return request({
        url: '/user/api/user/query/page',
        method: 'get',
        params: query
    })
}
// 获取用户数据
export function fetchRoleList(query) {
    return request({
        url: '/user/api/user/query/list',
        method: 'get',
        params: { enable: 1 }
    })
}
// 获取没有权限组的用户
export function fetchRoleListNoGroup(query) {
    return request({
        url: '/user/api/groups/query/list/user/out',
        method: 'get',
        params: query
    })
}
export function fetchRightGroups(query) {
    return request({
        url: '/user/api/groups/query/list',
        method: 'get',
        params: query
    })
}
export function fetchRightMenuList(id) {
    if (id) {
        return request({
            url: `/user/api/menuResource/query/authorization/${id}`,
            method: 'get'
                // params: query
        })
    }
}
export function fetchRightUserList(id) {
    if (id) {
        return request({
            url: `/user/api/groups/query/list/user/in/${id}`,
            method: 'get'
                // params: query
        })
    }
}
export function saveRightGroups(query) {
    if (query.id) {
        return request({
            url: `/user/api/groups`,
            method: 'put',
            data: query
        })
    } else {
        return request({
            url: `/user/api/groups`,
            method: 'post',
            data: query
        })
    }
}
export function delRightGroups(query) {
    return request({
        url: `/user/api/groups/${query}`,
        method: 'delete'
            // data: query
    })
}
export function saveRightOrgInfo(query) {
    return request({
        url: `/user/api/user/organRefs/grant`,
        method: 'put',
        data: query
    })
}
export function fetchCurrentOrgInfo(id) {
    return request({
        url: `/user/api/user/query/organRefs/${id}`,
        method: 'get'
            // params: query
    })
}